package com.mxpio.erp.common.technology.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @Author : wpp
 * @Datetime : 2023/7/28 10:27
 * @Desc :
 * @Modor :  Modifytime: 产品工艺路线
 * @modDesc :
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_TECHNOLOGY_PROD_ROUT")
@Schema(description="产品工艺路线")
public class ProdTecRout extends BaseEntity {

    private static final long serialVersionUID = 1L;
    /**工序编码*/
    @Id
    @Column(name = "ROUT_ID_", updatable = false)
    @Generator(policy = UUIDPolicy.class)
    @Schema(description = "路线主键")
    private String routId;

    @Column(name = "PRODUCT_ITEM_CODE_")
    @Schema(description = "产品编号")
    private String productItemCode;

    @Column(name = "PRODUCT_ITEM_NAME_")
    @Schema(description = "产品名称")
    private String productItemName;

    @Column(name = "ITEM_SPEC_")
    @Schema(description = "规格型号")
    private String itemSpec;

    @Column(name = "MEMO_")
    @Schema(description = "备注")
    private String memo;

    @Column(name = "PRODUCT_DRAWING_NO_")
    @Schema(description = "图号")
    private String productDrawingNo;


    @Column(name = "USE_TYPE_")
    @Schema(description = "使用状态")
    @Dict(dicCode="ERP_TECH_USE_TYPE")
    private String useType;

    @Column(name = "VERSION_")
    @Schema(description = "工艺版本")
    private String version;

    @Column(name = "BEGIN_TIME_")
    @Schema(description = "生效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date beginTime;

    @Column(name = "END_TIME_")
    @Schema(description = "失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @Column(name = "CHANGE_CODE_")
    @Schema(description = "变更单号")
    private String changeCode;

    @Column(name = "CHANGE_MAN_")
    @Schema(description = "变更人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String changeMan;

    @Column(name = "CHANGE_DATE_")
    @Schema(description = "变更日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date changeDate;

    @Column(name = "CHANGE_MEMO_")
    @Schema(description = "变更说明")
    private String changeMemo;

    @Column(name = "CHANGE_ATTACH_FILE_",length = 500)
    @Schema(description = "变更附件")
    private String changeAttachFile;

    @Column(name = "PRIMARY_ROUT_")
    @Schema(description = "是否当前使用路线",hidden=true)
    private String primaryRout;


    @Transient
    private List<ProdTecRoutProc> lineList;

}
